package main

func sum(values []int,rsltChan chan int)  {
	sum :=0
	for _,v := range values {
		sum += v
	}
	rsltChan <- sum
}

func main() {

	var arr1 [5]int  = [5]int{1,2,3,4,5}
	var arr2 []int = make([]int,5)
	var slice1 = arr1[2:3]
	var myslice = append(slice1,6)
	var myslice2 = make([]int,5)
	var myslice3 = []int{1,2,3}

	copy(myslice2,myslice3)

	println("hello world",len(arr1),cap(arr1))
	println("hello world",len(arr2),cap(arr2))
	println("hello world",len(slice1),cap(slice1))
	println("hello world",len(myslice),cap(myslice))
	println("hello world",len(myslice2),cap(myslice2))
	println("hello world",len(myslice3),cap(myslice3))
	println("hello world",myslice2[0],myslice2[4])

	values := []int{1,2,3,4,5,6,7,8,9,10}

	rsltChan := make(chan int,3)
	go sum(values[:len(values)/2],rsltChan)
	go sum(values[len(values)/2:],rsltChan)
	go sum(values[len(values)/3:],rsltChan)
	sum1,sum2,sum3 := <-rsltChan,<-rsltChan, <-rsltChan
	println("sum :",sum1+sum2+sum3)

	ch4 := make(chan int)
	ch5 := <-chan int(ch4)
	ch6 := chan<- int(ch4)
	println(ch5,ch6)



}
